/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ConnectDatabasse;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

/**
 *
 * @author User
 */
public class ConnectionData {

    Connection con = null;

    public Connection getConnect(){
  try{
      Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
      }catch(ClassNotFoundException ex){
        System.err.println("khong tao duoc Driver");
        System.exit(1);
      }
  String str = "jdbc:sqlserver://localhost:1433;databaseName=ATMmanager;user=sa;password=936764";
  try{
        con = DriverManager.getConnection(str);
      }catch(SQLException ex){
        System.err.println("khong ket noi duoc voi CSDL");
        System.exit(1);
      }
  return con;
    }
}
